package com.gagakuai.engine.impl.delegate;

import com.gagakuai.engine.impl.pvm.PvmActivity;
import com.gagakuai.engine.impl.pvm.PvmProcessDefinition;
import com.gagakuai.engine.impl.pvm.PvmProcessInstance;
import com.gagakuai.engine.impl.pvm.PvmTransition;
import com.gagakuai.engine.runtime.Execution;

import java.util.List;

/*
 * @program: common-starters
 * @description: 活动执行抽象
 * @author: houhong
 * @create: 2023-01-02 13:47
 */
public interface ActivityExecution extends DelegateExecution {

    /*
     * 获取到活动类
     */
    PvmActivity getActivity();

    /*
     * 创建一个活动类执行
     */
    ActivityExecution createExecution();

    /*
     * 通过给定的transition 离开当前的活动，会途经给出的transition
     */
    void take(PvmTransition transition);

    /*
     * 根据给定的流程定义来生成一个子流程实列
     */
    PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition);

    /*
     * 获取到父执行实列
     */
    ActivityExecution getParent();

    /*
     * 返回此执行的父级的执行列表
     */
    List<? extends ActivityExecution> getExecutions();

    ActivityExecution getProcessInstance();

    /*
     * 是否是流程实列类型
     */
    boolean isProcessInstanceType();

    /*
     * 当前执行结束
     */
    void end();


}